#!/bin/bash

# useCollectionTask - refetchInterval直接接收data作为第一个参数
sed -i '161s/refetchInterval: (data) => {/refetchInterval: (data) => {/' useCollectionTask.ts
sed -i '163s/if (query.state.data && (query.state.data.status === TaskStatus.RUNNING || query.state.data.status === TaskStatus.PENDING))/if (data \&\& (data.status === TaskStatus.RUNNING || data.status === TaskStatus.PENDING))/' useCollectionTask.ts

# useExportTask - refetchInterval直接接收data作为第一个参数
sed -i '133s/refetchInterval: (data) => {/refetchInterval: (data) => {/' useExportTask.ts
sed -i '135s/if (query.state.data && (query.state.data.status === ExportStatus.RUNNING || query.state.data.status === ExportStatus.PENDING))/if (data \&\& (data.status === ExportStatus.RUNNING || data.status === ExportStatus.PENDING))/' useExportTask.ts

echo "refetchInterval fixed to use data directly"
